{extend name="$base" /}
{block name="resources"}
<style>
.table-class tbody td{}
.statistics{border:1px solid #F5F6F5;width:25%;height:70px;float:left;}
.statistics img{padding:10px 0 0 15px;float:left;}
.statistics  ul{float:left;font-size:12px;margin: 0 0 10px 25px;}
.goods-name{max-width:30px;white-space: nowrap;overflow:hidden;text-overflow:ellipsis;}
</style>
{/block}
{block name="main"}
<table class="mytable">
	<tr>
		<td style="padding:10px;">
			<input type="text" id="startDate" class="input-common middle" placeholder="请选择开始日期" onclick="WdatePicker()" />
			&nbsp;-&nbsp;
			<input type="text" id="endDate" placeholder="请选择结束日期" class="input-common middle" onclick="WdatePicker()" />
			<button class="btn-common" onclick="LoadingInfo(1)" value="搜索" >搜索</button>
		</td>
	</tr>
</table>
<div class="total">
	<div class="statistics">
		<img src="__STATIC__/images/balance.png" />
		<ul>
			<li style="line-height: 40px;"><span>商品销售量</span></li>
			<li><span style="font-size: 15px; font-weight: bold;" id="goods_sale_num">0</span></li>
		</ul>
	</div>
</div>
<table class="table-class">
	<colgroup>
		<col style="width: 3%;">
		<col style="width: 40%;">
		<col style="width: 20%;">
		<col style="width: 10%;">
		<col style="width: 30%;">
	</colgroup>
	<thead>
		<tr>
			<th width="3%" style="text-align: center;"><i class="checkbox-common"><input type="checkbox" ></i></th>
			<th align="left">商品名称 </th>
			<th align="left">SKU名称</th>
			<th align="right">购买数量</th>
			<th align="center">购买时间</th>
		</tr>
	</thead>
	<colgroup>
		<col style="width: 3%;">
		<col style="width: 20%;">
		<col style="width: 20%;">
		<col style="width: 25%;">
		<col style="width: 25%;">
		<col >
	</colgroup>
	<tbody></tbody>
</table>
{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
function LoadingInfo(page_index) {
	var start_date = $("#startDate").val();
	var end_date = $("#endDate").val();
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/account/shopgoodsaccountList')}",
		data : {
			"page_index" : page_index,
			"page_size" : $("#showNumber").val(),
			"goods_id":"{$goods_id}",
			"start_date":start_date,
			"end_date":end_date
		},
		success : function(data) {
			if (data['data'].length > 0) {
				$(".table-class tbody").empty();
				for (var i = 0; i < data['data'].length; i++) {
				var html = '';
					html += '<tr align="center">';
					html += '<td ><i class="checkbox-common"><input name="sub" type="checkbox" value="" ></i></td>';
					html += '<td align="left" title="' + data['data'][i]["goods_name"] + '">' + data['data'][i]["goods_name"] + '</td>';
					html += '<td align="left">' + data['data'][i]["sku_name"] + '</td>';
					html += '<td align="right">' + data['data'][i]["num"] + '</td>';
					html += '<td>' + timeStampTurnTime(data['data'][i]["create_time"]) + '</td>';
					html += '</tr>';
					$(".table-class tbody").append(html);
				}
			} else {
				var html = '<tr align="center"><td colspan="4">暂无符合条件的数据记录</td></tr>';
				$(".table-class tbody").html(html);
			}
			$("#goods_sale_num").html(data['total_count']);
			initPageData(data["page_count"],data['data'].length,data['total_count']);
			$("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
		}
	});
}

function CheckAll(event){
	var checked = event.checked;
	$("#productTbody input[type = 'checkbox']").prop("checked",checked);
	if(checked) $(".table-class tbody input[type = 'checkbox']").parent().addClass("selected");
	else $(".table-class tbody input[type = 'checkbox']").parent().removeClass("selected");
}
</script>
{/block}